<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>我的发布 -觅TA网</title>
        <link rel="stylesheet" href="css/bootstrap.min.css" />
        <script type="text/javascript" src="js/jquery-3.3.0.js" ></script>
        <script type="text/javascript" src="js/bootstrap.min.js" ></script>
        <link rel="stylesheet" href="layui/css/layui.css">
        <link type="text/css" rel="stylesheet" href="css/xunwu.css"/>
        <style>
            .title a:hover{
                color: orange;
            }
            #list{
                table-layout:fixed;
            }
            .title,.lostPlace{
                word-break:keep-all;/* 不换行 */
                white-space:nowrap;/* 不换行 */
                overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */
                text-overflow:ellipsis;
            }
            #list tbody tr td{
                vertical-align: middle;
            }
        </style>
    </head>
    <body>
    <div id="settled"></div>
    <div id="content">
        <div style="width: 100%; height: 30px; border-bottom: 1px #9fd6ff solid; background: url(img/span_bg.bmp) repeat-x;">
            <img src="img/未标题-1.png" style="width: 20px;height: 20px;margin-top: 5px;float: left;"/>
            <span style="font-weight: 100;font-size: 16px;color:#1E7ACE; line-height: 30px;">我的发布</span>
        </div>
		<#if msgs??&&msgs?size gt 0>
            <table id="list" class="table table-striped" style="border-bottom: 1px solid #ddd;margin-bottom: 5px;">
                <#list msgs as msg>
                    <tr>
                        <td style="width: 10%;">
                            <#if msg.type==0>
                                寻物
                            <#elseif msg.type==1>
                                寻宠
                            <#elseif msg.type==2>
                                寻人
                            <#elseif msg.type==3>
                                招领
                            </#if>
                        </td>
                        <td style="width: 30%;" class="title"><a href="/detail?id=${msg.id}" target="_blank">${msg.title}</a></td>
                        <td style="width: 30%;" class="lostPlace">${msg.lostPlace}</td>
                        <td style="width: 15%;">${(msg.createTime?string("yyyy-MM-dd"))!.now?date}</td>
                        <td style="width: 15%;"><button class="btn btn-default btn-sm" type="submit" onclick="getId(${msg.id})"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 已找到</button></td>
                    </tr>
                </#list>
            </table>
		<#else>
            <div style="width:726px; height: 660px; margin: 0 auto; text-align: center; background-image: url(img/空空如也.png);">
            	<br><h1 style="color: darkgray;">空空如也~</h1>
        	</div>
		</#if>
    </div>

    <script src="layui/layui.js"></script>
    <script>
        $("#settled").load("/loadConstant");
        function getId(msgId){
            var data={id:msgId};
            layui.use('layer', function(){
                var layer = layui.layer;
                layer.open({
                    type:'0',
                    title: '失物/失主已找到',
                    btn:['确认','取消']
                    ,content: '确认删除吗？',
                    yes: function(index, layero){
                        $.ajax({
                            type : "POST",
                            //请求的媒体类型
                            contentType: "application/json;charset=UTF-8",
                            //请求地址
                            url : "/seekOut",
                            //数据，json字符串
                            data : JSON.stringify(data),
                            //请求成功
                            success : function(result) {
                                window.location.href="/myRelease";
                            }
                        });
                        layer.close(index);
                    }
                });
            });
        }

    </script>

    </body>


</html>